<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>机动车驾驶证基本信息查询</title>
    <link type="text/css" href="<c:url value='/resource/wx/newcss/common.css'/>" rel="stylesheet"/>
    <link rel="stylesheet" href="<c:url value='/resource/wechat/newcss/frozen.css'/>">
    <link rel="stylesheet" type="text/css" href="<c:url value='/resource/wechat/newcss/main.css'/>"/>
    <script type="text/javascript" src="<c:url value='/resource/wx/js/jquery-2.1.1.min.js'/>"></script>
    <script src="<c:url value='/resource/js/common.js'/>" type="text/javascript"></script>
    <style type="text/css">
        .ui-form-item label:not(.ui-switch):not(.ui-checkbox):not(.ui-radio){width: 105px;}
        .ui-form-item input, .ui-form-item textarea{padding-left: 105px;}
    </style>
</head>

<script type="text/javascript">
    function check(){
        var pushId = $("#pushId").val().trim();
        var pushType = $("#pushType").val().trim();
        var dabhFormat = /^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/;
        var fnFormat = /[a-z_A-Z_0-9]{12}/;
        var jtglywdxsfzhm = $("#jszhm").val().trim();
        var dabh = $("#dabh").val().trim();
        firnull = "驾驶证编号不能为空";
        secnull = "档案编号不能为空";
        firformet = "请输入15/18位驾驶证编号";
        secformet = "请输入12位档案编号";

        if(jtglywdxsfzhm == null || jtglywdxsfzhm == ""){
            toast(firnull);
            return false;
        }else if(dabh == null || dabh == ""){
            toast(secnull);
            return false;
        }
        else if(!dabhFormat.test(jtglywdxsfzhm)){
            //else if(jtglywdxsfzhm=="" || !(jtglywdxsfzhm.length == 15 || jtglywdxsfzhm.length == 18)){
            toast(firformet);
            return false;
        }else if(!fnFormat.test(dabh)){
            toast(secformet);
            return false;
        }else{
            $.ajax({
                url: "<c:url value='/api/query/license/points'/>",
                type: "post",
                data: {"jtglywdxsfzhm": jtglywdxsfzhm,"dabh":dabh,"pushId":pushId,"pushType":pushType},
                timeout: 6000,
                beforeSend: function () {
                    loading();
                },
                success: function (data) {
                    $("#btn_query").attr("disabled","disabled");
                    $("#btn_query").css("background-color","#DDDDDD");
                    $("#result").html(data.msg);
                    finish();
                    formSubmit();
                },
                error: function () {
                    finish("查询失败")
                }
            });
        }

    }
</script>

<body>
    <%--<header class="ui-header ui-header-positive ui-border-b">
        <i class="ui-icon-return" onclick="history.back()"></i>
        <h1>机动车驾驶证基本信息查询</h1>
    </header>--%>
    <section class="ui-container">
        <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
            <label for="#">
                驾驶证号：
            </label>
            <input id="jszhm" type="text" placeholder="">
        </div>
        <div class="ui-form-item ui-form-item-show ui-border-b bg_fff">
            <label for="#">
                档案编号：
            </label>
            <input id="dabh" type="text" placeholder="">
        </div>

        <div class="ui-btn-wrap">
            <input type="hidden" name="pushId" id="pushId" value="${pushId}" />
            <input type="hidden" name="pushType" id="pushType" value="${pushType}" />
            <button id="btn_query" class="ui-btn-lg ui-btn-primary" onclick="check();">
                查询
            </button>
        </div>

        <div id="result"></div>

        <div style="display: none">
            <table class="search_table">
                <tr>
                    <td width="90">姓名：</td>
                    <td>马云</td>
                </tr>
                <tr>
                    <td>档案编号：</td>
                    <td>123456</td>
                </tr>
                <tr>
                    <td>驾驶证号：</td>
                    <td>123456</td>
                </tr>
                <tr>
                    <td>准驾车型：</td>
                    <td>C</td>
                </tr>
                <tr>
                    <td>累计积分：</td>
                    <td>0</td>
                </tr>
                <tr>
                    <td>有效期止：</td>
                    <td>2016-12-31</td>
                </tr>
                <tr>
                    <td>联系地址：</td>
                    <td>北京</td>
                </tr>
            </table>
        </div>
    </section>
</body>
</html>
